package com.sy.controller.purchase;


import com.sy.bean.purchase.QueryStatistics;
import com.sy.common.bean.PageBean;
import com.sy.common.bean.ResultBean;
import com.sy.common.controller.BaseController;

import com.sy.common.utils.BeanOfMap;
import com.sy.service.purchase.StatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@Api(tags = "purchase=采购统计")
@RequestMapping("/api/pur")
public class StatisticsController extends BaseController {

    @Autowired
    StatisticsService statisticsService;

    @ApiOperation("采购统计")
    @PostMapping("/statistics")
    public ResultBean statistics(@RequestBody QueryStatistics statistics){
        PageBean bean= statisticsService.query(BeanOfMap.bom(statistics));
        return success("成功",bean);
    }

    @ApiOperation("导出采购统计表")
    @PostMapping("/export")
    public ResultBean export(@RequestBody Map map) {
        String url=statisticsService.export(map);
        return success("成功",url);
    }
}
